package cc.customer.web.cRound;

import cc.customer.cRound.domain.CRound;
import cc.customer.cRound.domain.CRoundConfig;
import cc.customer.cRound.service.CRoundService;
import cc.customer.common.domain.ResponseBo;
import cc.customer.system.domain.ExConfigRecord;
import cc.customer.web.sys.controller.base.BaseController;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "cRound")
@RestController
public class CRoundController extends BaseController {

    @Autowired
    private CRoundService cRoundService;

    /**新增轮询*/
    @RequestMapping(value = "addNewRound",method = RequestMethod.POST)
    @ResponseBody
    public ResponseBo addNewRound(CRound round){
        if(StringUtils.isEmpty(round.getrName())){
            return ResponseBo.error("缺少项目名称");
        }
        return cRoundService.addNewRound(round);
    }

    /**初始化推广模板**/
    @RequestMapping(value = "getAllRound")
    @ResponseBody
    public ResponseBo getAllRound(CRound round){
        if(StringUtils.isEmpty(round.getrType())){
            return ResponseBo.error("type为空");
        }
        return cRoundService.selcetAllRound(round);
    }

    /**删除**/
    @RequestMapping(value = "deleteRound")
    @ResponseBody
    public ResponseBo deleteRound(CRound round){
        return cRoundService.deleteRound(round);
    }


    /**查询制定模板部门信息**/
    @RequestMapping(value = "getRoundConfig")
    @ResponseBody
    public ResponseBo getRoundConfig(CRoundConfig roundConfig){

        return cRoundService.getRoundConfig(roundConfig);
    }



}
